package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.domain.SuperMerchantReply;
import com.ruoyi.system.mapper.SuperCommentImageMapper;
import com.ruoyi.system.mapper.SuperMerchantReplyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SuperCommentMapper;
import com.ruoyi.system.domain.SuperComment;
import com.ruoyi.system.service.ISuperCommentService;

/**
 * 商品评论Service业务层处理
 * 
 * @author xjf
 * @date 2025-08-13
 */
@Service
public class SuperCommentServiceImpl implements ISuperCommentService 
{
    @Autowired
    private SuperCommentMapper superCommentMapper;
    @Autowired
    private SuperMerchantReplyMapper superMerchantReplyMapper;

    /**
     * 查询商品评论
     * 
     * @param id 商品评论主键
     * @return 商品评论
     */
    @Override
    public SuperComment selectSuperCommentById(Long id)
    {
        return superCommentMapper.selectSuperCommentById(id);
    }

    /**
     * 查询商品评论列表
     * 
     * @param superComment 商品评论
     * @return 商品评论
     */
    @Override
    public List<SuperComment> selectSuperCommentList(SuperComment superComment)
    {
        return superCommentMapper.selectSuperCommentList(superComment);
    }

    /**
     * 新增商品评论
     * 
     * @param superComment 商品评论
     * @return 结果
     */
    @Override
    public Long insertSuperComment(SuperComment superComment)
    {
        superCommentMapper.insertSuperComment(superComment);
        // 插入成功后，ID 会自动回填到 superComment 对象中
        Long insertedId = superComment.getId();
        SuperMerchantReply superMerchantReply = new SuperMerchantReply();
        superMerchantReply.setCommentId(superComment.getId());
        superMerchantReply.setStatus("0");
        superMerchantReplyMapper.insertSuperMerchantReply(superMerchantReply);
        return insertedId;
    }

    /**
     * 修改商品评论
     * 
     * @param superComment 商品评论
     * @return 结果
     */
    @Override
    public int updateSuperComment(SuperComment superComment)
    {
        return superCommentMapper.updateSuperComment(superComment);
    }

    /**
     * 批量删除商品评论
     * 
     * @param ids 需要删除的商品评论主键
     * @return 结果
     */
    @Override
    public int deleteSuperCommentByIds(Long[] ids)
    {
        return superCommentMapper.deleteSuperCommentByIds(ids);
    }

    /**
     * 删除商品评论信息
     * 
     * @param id 商品评论主键
     * @return 结果
     */
    @Override
    public int deleteSuperCommentById(Long id)
    {
        return superCommentMapper.deleteSuperCommentById(id);
    }
}
